﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 多协议通信平台.Common
{
    public class ContextHelper
    {
        private static Dictionary<string, object> _context = new Dictionary<string, object>();

        public static void Set(string key, object value)
        {
            _context[key] = value;
        }

        public static T Get<T>(string key) 
        {
            bool flag = _context.TryGetValue(key, out object val);
            if (flag)
            {
                return (T)val;
            }
            return default(T);
        }
    }
}
